<template>
<div>
  <div class="container">
  <van-tabs v-model="activeName">
    <van-tab title="账号密码登录" name="a" class="headerB" style="font-size: 50px" >
      <van-field v-model="userName"  left-icon="contact" placeholder="请输入用户名"/>
      <van-field v-model="password"  type="password" left-icon="bag-o" placeholder="请输入密码"/>
      <van-button type="info" style="width: 80%;margin-top: 30px; border-radius: 30px;background-color: #f8c66b; border: 1px solid orange;font-size: large;" @click="login">登录</van-button>
    </van-tab>
  </van-tabs>
  <div class="footer">
    <span @click="regis">用户注册</span> | <span @click="changefg">忘记密码</span>
  </div>
</div>
</div>
</template>

<script>
import {getLogin} from "@/api/api-Login";

export default {
name: "LoginSelf",
  data(){
  return{
    activeName:"",
    userName:"",
    password:"",
    rememberMe:"true"
  }
  },
  methods: {
    regis() {
      this.$router.push('/Login/Register')
    },
    changefg(){

      this.$router.push('/Login/ForgetPassword')
    },
    login() {
      // let logindata = new FormData
      // logindata.append('username', this.username)
      // logindata.append('password', this.password)
      // logindata.append('rememberMe', true)
      // let data = {'username': this.newUsername, 'password': this.newPassword}
      getLogin(this.userName,true,this.password).then((res) => {
        console.log(res)
        if(res.code===0){
          this.$router.push('/Login/PersonInfo')
        }else {
          this.$toast(res.msg)
        }

      })
    }
  }
}
</script>

<style scoped lang="less">
.footer{
  margin-top: 50px;
  text-align: center;
  font-size: 15px;
}
span{
  margin: 0 20px;
}
span:hover{
  color: orange;
}
.container{
  margin-top: 150px;

}
.headerB{
  margin: auto;
  text-align: center;

}
</style>